package cn.bblocks.cacheTest.constant;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Component;

/**
 * @description:
 * @author: mpc
 * @create: 2019-03-20 23:39
 **/
@Component
public class Constant {
	//spring上下文
	public static ApplicationContext appContext = null;
	
    public final static String USER_ID="user.id";
    public final static String USER_NAME="user.name";

    public final static String HEAD_TOKEN_KEY ="token";//目前是放在post表单中
    public final static String PUSH_MESSAGE_PRE_ACTIVITY="activity=";
    
    @Autowired
    public void setAppContext(ApplicationContext appContext) {
    	Constant.appContext = appContext;
    }
    
    
    public static class SystemConfig {

        public static final String HEAD_VERSION = "LT-APPVERS";//版本号

        public static final String HEAD_APPTYPE = "LT-APPTYPE";//1-安卓 2-IOS

        public static final String HEAD_PID = "LT-PID";//product id

        public static final String HEAD_APPCHG = "LT-APPCHG";//app 类型(渠道)
        
        public static final String HEAD_DEVID = "LT-DEVID";//设备ID
        
        public static final String HEAD_SERTAG = "LT-SERTAG";//指定服务器 （为空则走通用）
        
        
        //其他参数如：sysversion = 9    mobelversion = MI 8
        
    }
    
    

    public static class ErrorCode {

        public static final int SUC = 0;//成功
        
        
        //其他业务错误码
        public static final int ERR_GENERAL = 7;//通用错
        public static final int ERR_ACTIVITY_NO = 100;//无活动
        public static final int ERR_PATCH_MISS = 101;//碎片不足
        public static final int ERR_PRIZE_FULL = 102;//红龙数量已满
        
        public static final int ERR_PRIZED = 103;//任务已领取
        public static final int ERR_PRIZED_UN = 104;//未中奖
        public static final int ERR_COMPOSE_FAILE = 105;//合成失败
//        public static final int ERR_COMPOSE_NO_ENOUGH = 106;//无足够碎片
//        public static final int ERR_COMPOSE_NO_HL = 107;//
        
        public static final int ERR_ACTIVITY_OVER = 106;//活动结束
        public static final int ERR_PRIZED_EMPTY = 107;//空奖（谢谢惠顾）
        public static final int ERR_NOT_MEMBER = 108;//非会员
        
        public static final int ERR_OPTED = 109;//已操作过
        public static final int ERR_TASK_UNDONE = 110;//任务未完成
        
        //控制相关
        public static final int ERR_NOLOGIN = 401;//未登录
        public static final int ERR_REPEAT = 410;//重复提交（或者频率过高）
        
        
        public static final int ERR_APPVERSIONFORCE = 90;//版本错误（强制）
        public static final int ERR_APPVERSIONCHOICE = 91;//版本错误（选择）
        
        
        //通道通信异常
        public static final int ERR_COMM = 500;
        public static final int ERR_COMM_RETERROR = 501;
        
    }

}
